<template>
    <div>
        <Header></Header>
        <group style="margin-top:-20px;">
            <section v-if="!list" class="noMessage">
                <img src="http://img.17k.com/touch/skin/usermessage/nomessage.png">
                <p>暂时没有消息哦~</p>
		    </section>    
            <panel header="我的消息"  :list="list" type="2"></panel>
        </group>    
        <Footer></Footer>
    </div>
</template>

<script>
import Header from '@/components/commons/header/header'
import Footer from '@/components/commons/footer/footer'
import USER from '@/utils/user'
import userController from '@/api/userController/index'
    export default {
        name:'mynews',
        data () {
            return {
                userInfo: null,
                list: [{                    
                    title: '审核通知',
                    desc: '恭喜您，您的小说test777通过审核。'
                },
                {                    
                    title: '审核通知',
                    desc: '您的小说由于字数低于500，未通过审核。'
                }]
            }
        },
        created(){
            this.getLoginInfo();
        },
        components: {Header, Footer},
        methods:{
            getLoginInfo(){ //获取登录信息,如果登录，重定向至登录页面
                var loginInfo = USER.getUserInfo();
                this.userInfo = loginInfo;
                if(loginInfo.isLogin==1){ //0已登录 1未登录
                this.$router.push({name:'login'})
                }else{
                    this.getTotalList(); //获取消息数量
                }
            },
             getTotalList(){ //获取消息数量
                var formData = {
                userId: this.userInfo.userId,
                status: 0
                }
                userController.getTotalList(formData).then(response=>{
                    // this.list = response.totalRows;
                })
            },
        }
    }
</script>

<style scoped>
.noMessage {
    padding: 5em 0;
    text-align: center;
    color: #6d6d6d;
}

</style>